<?php
require_once($_SERVER['DOCUMENT_ROOT'] . '/fatec-si/email/' . 'class.phpmailer.php');

class EmailController{

	private function _send($to, $from, $from_name, $subject, $body) {
		$mail = new PHPMailer();
		$mail->IsSMTP();
		$mail->SMTPDebug = 0;
		$mail->SMTPAuth = true;
		$mail->SMTPSecure = 'ssl';
		$mail->Host = 'smtp.gmail.com';
		$mail->Port = 465;
		$mail->Username = GUSER;
		$mail->Password = GPWD;
		$mail->SetFrom($from, $from_name);
		$mail->Subject = $subject;
		$mail->Body = $body;
		$mail->AddAddress($to);
		return $mail->Send();
	}

	public function send($p){
		return $this->_send($p['to'],GUSER,"Notificacao","Notificacao",$p['message']);
	}

}

?>